package org.genew.squadra.xml.presentation;
import org.genew.squadra.xml.common.ValidationUtility;
import org.genew.squadra.xml.model.epubbiblio.MyEpubForm;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.stereotype.Component;
@Component
public class insertValidator implements Validator {

	@Override
	public boolean supports(Class<?> klass) {
		// TODO Auto-generated method stub
		return MyEpubForm.class.isAssignableFrom(klass);
	}

	@Override
	public void validate(Object target, Errors error) {
		MyEpubForm myform =(MyEpubForm) target;
		System.out.println("save the world");
		ValidationUtility.rejectIfEmpty(error, "errors.empty", myform.getePubFiles(), "ePubFiles");
		ValidationUtility.rejectIfBadExtension(error, "errors.badextension", myform.getePubFiles(), "ePubFiles");
	}
	
	
	

}
